package com.hjxr.sysadmin.zsj.service.impl;

import java.util.List;

import com.hjxr.framework.config.ServerConfig;
import com.hjxr.sysadmin.zsj.domain.Introduction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hjxr.sysadmin.zsj.mapper.ActivityMapper;
import com.hjxr.sysadmin.zsj.domain.Activity;
import com.hjxr.sysadmin.zsj.service.IActivityService;

/**
 * 招商活动信息Service业务层处理
 *
 * @author xk
 * @date 2021-03-23
 */
@Service
public class ActivityServiceImpl implements IActivityService
{
    @Autowired
    private ActivityMapper activityMapper;

    @Autowired
    private ServerConfig serverConfig;

    /**
     * 查询招商活动信息
     *
     * @param activityId 招商活动信息ID
     * @return 招商活动信息
     */
    @Override
    public Activity selectActivityById(Long activityId)
    {
        return activityMapper.selectActivityById(activityId);
    }

    /**
     * 查询招商活动信息列表
     *
     * @param activity 招商活动信息
     * @return 招商活动信息
     */
    @Override
    public List<Activity> selectActivityList(Activity activity)
    {
        List<Activity> list = activityMapper.selectActivityList(activity);
        for (Activity activityItem : list) {
            activityItem.setActivityPhoto(serverConfig.getUrl() + activityItem.getActivityPhoto());
        }
        return list;
    }

    /**
     * 新增招商活动信息
     *
     * @param activity 招商活动信息
     * @return 结果
     */
    @Override
    public int insertActivity(Activity activity)
    {
        return activityMapper.insertActivity(activity);
    }

    /**
     * 修改招商活动信息
     *
     * @param activity 招商活动信息
     * @return 结果
     */
    @Override
    public int updateActivity(Activity activity)
    {
        return activityMapper.updateActivity(activity);
    }

    /**
     * 批量删除招商活动信息
     *
     * @param activityIds 需要删除的招商活动信息ID
     * @return 结果
     */
    @Override
    public int deleteActivityByIds(Long[] activityIds)
    {
        return activityMapper.deleteActivityByIds(activityIds);
    }

    /**
     * 删除招商活动信息信息
     *
     * @param activityId 招商活动信息ID
     * @return 结果
     */
    @Override
    public int deleteActivityById(Long activityId)
    {
        return activityMapper.deleteActivityById(activityId);
    }
}
